import { ReactChild } from 'react'

// -------------------------- index.vue -------------------------------
export interface IOptionCategories {
    val: string;
    label: string;
}

export interface IOptionFilters {
    val: string;
    name: string;
}

export interface IDataSource {
    categories: IOptionCategories[];
    filters: IOptionFilters[];
}

export interface ISelectProps {
    dataSource: IDataSource;    // 数据源
    onChange: (opt: { value: string, label: string }) => void;       // 事件
    defaultValue?: string;      // 默认选中项的 value 值
    placeholder?: string;       // 没有值时提示文案
}

// -------------------------- Option.vue -------------------------------
export interface IOptionProps {
    label: string;
    value: string;
    defaultValue?: string;
    type?: 'radio';
    className?: string;
    onSelect?: (value: string, label: string) => void;
}

// -------------------------- Position.vue -------------------------------
export interface IPositionProps {
    targetRef: any;             // 下拉框 Dom 对象
    children?: ReactChild;             // 下拉面板子元素
    onClose: () => void;        // 隐藏下拉面板
}